package cn.stormling.note2;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.util.Date;

@SpringBootApplication
@EnableScheduling //开启定时
public class QuartApplication {

    public static void main(String[] args) {
        SpringApplication.run(QuartApplication.class, args);
    }

    //每五秒执行一次
    @Scheduled(cron = "0/5 * * * * *")
    public void cron() {
        System.out.println("主程序5秒调1次：" + new Date());
    }
}
